/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

#ifndef _COMM_PAGE_H
#define _COMM_PAGE_H

#include "NodePages.h"

class CommPage : public NodePage
{
	public:
		CommPage() { total_rate_tx = NAN; total_rate_rx = NAN; }

		virtual void update();
		virtual bool create_page(Client *client, GtkBuilder *builder);
		virtual void setCMD_RX(uint8_t cmd_id, int ack_nack=-1);


	protected:
		//--------------------PAGE VARIABLES--------------------//
		float      total_rate_tx;
		float      total_rate_rx;

		TestType   test_type;
		float      test_time;
		float      throughput_val;
		float      max_throughput;
		bool       throughput_test_running;

		//-- display --//
		//   in this section, add the names of the widgets you designed
		//   in glade for the page you are creating
		
		GtkWidget * num_clients;
		GtkWidget * bytes_tx;
		GtkWidget * bytes_rx;
		GtkWidget * rate_tx;
		GtkWidget * rate_rx;
		GtkWidget * rate_plot;
		GtkWidget * node_rssi;

		GtkWidget * comm_rate_test;
		GtkWidget * comm_rate_test_time;
		GtkWidget * comm_rate_scale;
		GtkWidget * comm_rate_tcp;
		GtkWidget * comm_rate_udp;

		//-- rssi tree view --//
		GtkListStore * list_store;
		GtkTreeView  * treeview;

		void format_treeview(); // this formats the columns
		void create_node_rssi_tree(); // creates the list model
		void update_link_list(); // update the values in the tree model
		void update_throughput_test(); // update the values in the throughput test

		//-- callbacks --//
		//  in this section, add any of the callbacks you need to handle
		//  user input. Note, more than likely these will need to be static functions.
		//  Also, for the pointer we pass the WindowStruct pointer, which provides
		//  all the inormatio necessary to dray any/all pages
		
		// send the waypoint value to goto
		static void tp_test_clicked(GtkButton *widget, gpointer data); 
};
#endif
